﻿@using System.Text.Encodings.Web
@{
    //success messages
    var successMessages = new List<string>();
    if (TempData[$"Grand.notifications.{NotifyType.Success}"] != null)
    {
        successMessages.AddRange(TempData[$"Grand.notifications.{NotifyType.Success}"] as IList<string>);
    }

    if (ViewData[$"Grand.notifications.{NotifyType.Success}"] != null)
    {
        successMessages.AddRange(ViewData[$"Grand.notifications.{NotifyType.Success}"] as IList<string>);
    }

    //error messages
    var errorMessages = new List<string>();
    if (TempData[$"Grand.notifications.{NotifyType.Error}"] != null)
    {
        errorMessages.AddRange(TempData[$"Grand.notifications.{NotifyType.Error}"] as IList<string>);
    }

    if (ViewData[$"Grand.notifications.{NotifyType.Error}"] != null)
    {
        errorMessages.AddRange(ViewData[$"Grand.notifications.{NotifyType.Error}"] as IList<string>);
    }
}
@foreach (var message in successMessages)
{
    <script asp-location="Footer" asp-order="901">
        vm.displayBarNotification('@Html.Raw(JavaScriptEncoder.Default.Encode(message))','', 'success', 3500);
    </script>
}
@foreach (var message in errorMessages)
{
    <script asp-location="Footer" asp-order="901">
        vm.displayBarNotification('@Html.Raw(JavaScriptEncoder.Default.Encode(message))','', 'error', 3500);
    </script>
}

<div id="bar-notification" class="generalNote"></div>
<div class="modal-place"></div>
<partial name="Partials/PopupAddToCart"/>
<partial name="Partials/ProductQuickView"/>